package com.txy.dao.impl;

import com.itany.jdbc.core.JdbcTemplate;
import com.txy.dao.DepartmentDao;
import com.txy.entity.Department;

import java.util.List;

/**
 * Author：汤小洋
 * Date：2022-11-08 16:58
 * Description：<描述>
 */
public class DepartmentDaoImpl implements DepartmentDao {

    JdbcTemplate<Department> jt = new JdbcTemplate<>();

    @Override
    public List<Department> selectAll() {
        String sql = "select id,name,loc from t_dept";
        return jt.query(sql, rs -> {
            Department d = new Department();
            d.setId(rs.getInt("id"));
            d.setName(rs.getString("name"));
            d.setLoc(rs.getString("loc"));
            return d;
        });
    }
}
